<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery/jquery-2.0.3.min.js"></script>
    <script src="js/angular/angular.min.js"></script>
</head>
<body>
    <div ng-app="index_app" ng-controller="index_ctrl">
        <div id="content">{{ div_model }}</div>
    </div>
    <script>
        var index_app = angular.module('index_app', []);
        
        index_app.controller('index_ctrl', function ($scope, $http) {

            $http.get("http://1.1.7.253:8080/device").then(function (response) {
                console.log(response.data);
                $scope.div_model = JSON.stringify(response.data);
            });
            
            $http.post("http://1.1.7.253:8080/device", postData).then(function (response) {
                console.log(response.data);
                $scope.div_model = JSON.stringify(response.data);
            });

            $http.post("http://1.1.7.253:8080/device/33/box033/2018071719570033").then(function (response) {
                console.log(response.data);
                $scope.div_model = JSON.stringify(response.data);
            });

            $http.put("http://1.1.7.253:8080/device", postData).then(function (response) {
                console.log(response.data);
                $scope.div_model = JSON.stringify(response.data);
            });
            
            $http.delete("http://1.1.7.253:8080/device/deleteByKey?key=1,2,3,4,5").then(function (response) {
                console.log(response.data);
                $scope.div_model = JSON.stringify(response.data);
            });
            
            $http({
                method: 'POST',
                url: 'http://1.1.7.253:8080/device',
                data: postData,
                headers: { 'Content-Type': 'application/json' }
            }).then(function (response) {
                console.log(response);
                console.log(response.data);
                $scope.div_model = response.data;
            });

            var postData = {
                id: 55,
                name: 'box055',
                deviceId: '2018071719570055'
            };
            
			$.ajax({
				type: 'delete',
				url: 'http://1.1.7.253:8080/device',
				contentType: 'application/json;charset=utf-8',
				dataType: 'json',
				data: JSON.stringify(postData),
				success: function(data) {
	                console.log(data);
	                $("#content").html(JSON.stringify(data));
				}
			});
            
			$.ajax({
				type: 'put',
				url: 'http://1.1.7.253:8080/device',
				contentType: 'application/json;charset=utf-8',
				dataType: 'json',
				data: JSON.stringify(postData),
				success: function(data) {
	                console.log(data);
	                $("#content").html(JSON.stringify(data));
				}
			});

			$.ajax({
				type: 'get',
				url: 'http://1.1.7.253:8080/device/44',
				dataType: 'json',
				success: function(data) {
	                console.log(data);
	                $("#content").html(JSON.stringify(data));
				}
			});
            
			$.ajax({
				type: 'post',
				url: 'http://1.1.7.253:8080/device',
				contentType: 'application/json;charset=utf-8',
				dataType: 'json',
				data: JSON.stringify(postData),
				complete: function(response) {
	                console.log(response);
	                $("#content").html(JSON.stringify(response.responseJSON));
				}
			});
        });
    </script>

</body>
</html>